﻿using System;
using System.Collections;
using System.Text;

namespace Demo0
{
    class Program
    {


        public static IEnumerable TestCode2()
        {


            int x = 3;

            while (x != 10)
            {
                yield return x;
                x++;

            }

            yield break;

        }

        static void Main(string[] args)
        {
            Console.WriteLine("TestCod2");


            IEnumerator FSM = TestCode2().GetEnumerator();


            while (FSM.MoveNext() == true)
            {
                Console.ReadKey();
                Console.WriteLine("");
                Console.WriteLine("count = {0}", FSM.Current);
            }

            Console.WriteLine("TestCod2");

            foreach (int count in TestCode2())
            {
                Console.WriteLine("count = {0}", count);
            }

        }
    }
}
